package jgl.vajra.operator.part.vehicle.model;

import java.util.Map;

import io.reactivex.Observable;
import jgl.vajra.operator.bean.OrderDetailsBean;
import jgl.vajra.operator.bean.OrderPaymentDetailsBean;
import jgl.vajra.operator.manager.AccountManager;
import jgl.vajra.operator.part.vehicle.contract.OrderDetailsContract;
import jgl.vajra.operator.widget.manager.RxJavaHttpManager;
import jgl.vajra.operator.widget.manager.retrofit.RetrofitJsonManager;
import jgl.vajra.operator.widget.utils.UIUtils;

public class OrderDetailsModel extends OrderDetailsContract.Model{

    @Override
    public Observable<OrderPaymentDetailsBean> getOrderPaymentDetailsData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getOrderPaymentDetailsData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<String> cancelOrder(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().cancelOrder(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<OrderDetailsBean> getOrderDetailsData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getOrderDetailsData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<OrderDetailsBean> getWorkingState(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getWorkingState(map, AccountManager.getInstance().getLoginData(UIUtils.getContext()).authorization)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<OrderDetailsBean> getStartData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getStartData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }
}
